﻿@{
    ViewBag.Title = "AiditForm";
    Layout = "~/Views/Shared/_LayoutIndex.cshtml";
}@using LeSoft.Application.Code;
<script>
    var keyValue = request('keyValue');
    var Type = "", Memo = "", IsCheck = 3;
    $(function () {
        initControl();
    })
    function initControl() {
        $("#AiditType").ComboBox({
            data: [{ "key": "1", "value": "系统流程" }, { "key": "2", "value": "人工审核" }],
            id: "key",
            text: "value",
            description: "=选择审核方式=",
            height: "150px",
            click: function (e) {
                if (e.attr('data-value') == 1) {
                    $("#TrWay1").removeAttr("hidden");
                    $("#TrWay2").attr("hidden", "hidden");
                }
                if (e.attr('data-value') == 2) {
                    $("#TrWay2").removeAttr("hidden");
                    $("#TrWay1").attr("hidden", "hidden");
                }
                else {

                }

            }
        });
        $("#AiditType").ComboBoxSetValue("2");
        if (!!keyValue) {

        }
    }
    function AcceptClick() {
        if (!$('#Aiditform').Validform()) {
            return false;
        }
        if (IsCheck == 3) {
            dialogMsg('未选择审核结果！', 0);
            return false;
        }

        Type = $("#AiditType").attr("data-value");
        Memo = $("#Description").val();
        if (Memo === "" && IsCheck == 2) {
            dialogMsg('未说明不通过原因！', 0);
            return false;
        }
        dialogConfirm('审核后将无法更改，是否确定审核！', function (r) {
            if (r) {
                var postData = $("#PSBillfrom").GetWebControls(keyValue);
                $.SaveForm({
                    url: "../../ResourceManage/RS_PStructPublish/AiditBill",
                    param: { keyValue: keyValue, Type: 3, IsCheck: IsCheck, Memo: Memo },
                    loading: "正在保存数据...",
                    success: function () {
                        $.currentIframe().$("#gridTable").resetSelection();
                        $.currentIframe().$("#gridTable").trigger("reloadGrid");
                    }
                })
            }
        });

    }
    function btn_Close() {
        dialogClose();
    }
    function Rdo_Trial(s) {
        IsCheck = s;
    }
</script>
<div style="width:90%; margin-top:0px;">
    <table class="form" id="Aiditform" style="margin:0px auto;">
        <tr><td colspan="4" style="height:10px;"></td></tr>
        <tr hidden>
            <td class="formTitle">审核方式<font face="宋体">*</font></td>
            <td class="formValue" colspan="3">
                <div id="AiditType" type="selectTree" class="ui-select"></div>
            </td>
        </tr>
        <tr hidden id="TrWay1">
            <td class="formTitle">选择流程</td>
            <td class="formValue" colspan="2">
                <div id="FlowId" type="selectTree" class="ui-select"></div>
            </td>
            <td class="formTitle">

                <a id="btn_last" onclick="btn_YL();" class="btn btn-default ">预览</a>
            </td>
        </tr>
        <tr>
            <td style="text-align:right;">审核结果：</td>

            <td colspan="2">
                &nbsp;&nbsp;<input name="Trial" type="radio" id="chk" onchange="Rdo_Trial(1)" value="1" />通过
                &nbsp;&nbsp;&nbsp;&nbsp;<input name="Trial" id="Uchk" onchange="Rdo_Trial(2)" type="radio" value="0" />不通过
            </td>
        </tr>
        <tr id="TrWay2">
            <td class="formTitle" style="height: 37px;"> 审核说明</td>
            <td class="formValue" colspan="3">
                <textarea id="Description" class="form-control" style="height: 100px;"></textarea>
            </td>
        </tr>
    </table>
</div>
<div class="form-button" id="wizard-actions">
    <a id="btn_last" onclick="AcceptClick();" class="btn btn-success ">确认</a>
    <a id="btn_finish" onclick="btn_Close();" class="btn btn-danger ">关闭</a>
</div>
